var Bank={
	addProject:function(url){
		$('#projectAddForm').form('submit',{
			url:url,
            onSubmit: function(){
                return $(this).form('validate');
            },
            success: function(result){
            	var result=eval('('+result+')');
                if (!result.status){
                    
					$.messager.alert('错误提示!',result.message);
					
                } else if(result.id){
                	// add success
					//add -> edit
				/* 	$("input.projectFormId", "#projectAddForm").val(result.id);
					// desc tab
					var tab = $('#addProjectBox').tabs('getTab',1);  // get selected panel
					$('#addProjectBox').tabs('update', {
						tab: tab,
						options: {
							title: '项目详细信息',
							href: addProjectDescUrl+'?id='+result.id  // the new content URL
						}
					});//.tabs('select', '项目详细信息'); */
					
					$.messager.alert('提示!','添加成功！请继续填写项目描述！');
					
                } else {
                	$.messager.alert('修改成功!',result.message);
                }
            }

		});
	},
	editProject:function(url){
		$('#projectEditForm').form('submit',{
			url:url,
            onSubmit: function(){
                return $(this).form('validate');
            },
            success: function(result){
            	var result=eval('('+result+')');
                if (!result.status){
					$.messager.alert('错误提示!',result.message);
                } else {
					$.messager.alert('修改成功!',result.message);
                }
            }

		});
	},
    editPublicProject:function(url){
        $('#editPublicProjectForm').form('submit',{
            url:url,
            onSubmit: function(){
                return $(this).form('validate');
            },
            success: function(result){
                var result=eval('('+result+')');
                if (!result.status){
					$.messager.alert('错误提示!',result.message);
                } else {
					$.messager.alert('修改成功!',result.message);
                }
            }
        });
    },
	edit:function(url){
		var row = $('#projectList').datagrid('getSelected');
            if (row){
                url = url +'?id='+row.id;
				showTab(url,'修改项目');
            }

	},
	formatTime:function(dataObj){
		dataObj.start_time = timestampToDateTime(dataObj.start_time);
		dataObj.end_time =timestampToDateTime(dataObj.end_time);
		return dataObj;
	},
	timetype:function(times){
		var Htime = ((times /3600) > 10) ? ('0'+(times/3600)):(times/3600);
		var itime = (times%3600); 
		var stime = ((itime%60)>10)?('0'+(itime%60)):(itime%60);
		var backtime  = ((itime/60)>10) ? ('0'+(itime/60)) : (itime/60);
		return Htime +':'+ backtime;
	}
	
}
